package com.cloud.example.business.mapper;


import com.cloud.example.business.mapper.entity.CloudLogicEntity;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author chengrui
 */
@Repository
@Mapper
public interface CloudLogicMapper extends JpaRepository<CloudLogicEntity, Long> {
    /**
     * 根据subject_id进行查询所有
     *
     * @param subjectId
     * @param pageable
     * @return
     */
    Page<CloudLogicEntity> findBySubjectId(Long subjectId, Pageable pageable);

    /**
     * 查询跨域
     *
     * @param subjectId
     * @param pageable
     * @return
     */
    Page<CloudLogicEntity> findBySubjectIdIn(List<Long> subjectId, Pageable pageable);


    /**
     * 主键查询
     *
     * @param logicId
     * @return
     */
    CloudLogicEntity findByLogicId(Long logicId);


    /**
     * 模糊查询数据
     *
     * @param context
     * @param pageable
     * @return
     */
    Page<CloudLogicEntity> findByLogicContextContaining(String context, Pageable pageable);


}

